<?php

/**
 * Intervenants form.
 *
 * @package    espace14
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class IntervenantsForm extends BaseIntervenantsForm
{
  public function configure()
  {
   $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      //'photourl'    => new sfWidgetFormTextarea(),
	  // 'photourl'    => new sfWidgetFormInputFileEditable(array('file_src'  => sfConfig::get('sf_root_dir').'/'.sfConfig::get('sf_web_dir_name')
	  // .'/'.sfConfig::get('sf_image_dir_name')
	  // .'/'.sfConfig::get('sf_upload_dir_name'), 
   			            // 'is_image' => true,
						// 'with_delete' => true,
			            // 'edit_mode' => !$this->isNew(),)),
	  'photourl'	=> new sfWidgetFormInputFile(),
      'nom'         => new sfWidgetFormInputText(),
	  'description' => new sfWidgetFormInputHidden(),
	  'fonction'    => new sfWidgetFormSelect(array('choices'=>array('Intervenant','Comite Directeur','Comite Scientifique'))),
    ));

	$this->widgetSchema->setLabel('photourl','Photo');
	
    $this->setValidators(array(
       'id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'photourl'    => new sfValidatorFile(array('max_size' => '20971520','required'=>false)),
      'nom'         => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'description' => new sfValidatorString(array('max_length' => 3000, 'required' => false)),
	  'fonction'	=> new sfValidatorChoice(array('choices'=>array_keys(array('Intervenant','Comite Directeur','Comite Scientifique')),'required'=>false)),
	 // 'fonction'	=> new sfValidatorChoice(array('choices'=>array_keys(array('1','2','3')),'required'=>false)),
    ));
	
	$this->setDefaults(
		array('fonction'=>1)
	);
	//$this->validatorSchema['photourl_delete'] = new sfValidatorBoolean();
	$this->widgetSchema->setNameFormat('intervenants[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::configure();
	
  }
}
